package cn.bmbanjia.zebra2024.tencentcloud;

import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.vms.v20200902.VmsClient;
import com.tencentcloudapi.vms.v20200902.models.SendTtsVoiceRequest;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class TencentCloudVMS {

    public final static String SECRET_ID = "AKIDymMglcIkxvd6JGxPcZJo6AzZu0rSoulM";
    public final static String SECRET_KEY = "PYR4YmlUxBAtMbbLq67sNccMq5bsugCS";
    public final static String VOICE_SDK_APPID = "1400420153";
    public final static String TEMPLATE_ID = "1356600";
    public final static String TEMPLATE_ID_CLEW = "1482381";
    public final static String REGION = "ap-guangzhou";
    public final static Credential CREDENTIAL = new Credential(SECRET_ID, SECRET_KEY);
    public final static VmsClient client = new VmsClient(CREDENTIAL, REGION);

    public static void sendTtsVoice(String voiceSdkAppid, String calledNumber, String templateId, String... templateParams) {
//        VmsClient client = new VmsClient(CREDENTIAL, REGION);
        SendTtsVoiceRequest req = new SendTtsVoiceRequest();
        req.setTemplateId(templateId);
        req.setTemplateParamSet(templateParams);
        req.setCalledNumber("+86" + calledNumber);
        req.setVoiceSdkAppid(voiceSdkAppid);
        req.setPlayTimes(3L);
        try {
            client.SendTtsVoice(req);
        } catch (TencentCloudSDKException e) {
            log.error("", e);
        }

    }

}
